Part Number Hot Search : 
030K1F MTZJ12 68HC705 BZT5232B 4752A RF150 FX589D 74LV14A
Product Description
Full Text Search
 

To Download AN2989 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  june 2009 doc id 15761 rev 1 1/28 AN2989 application note lis331dlm: 2 g /4 g /8 g digital output high performance ultra low-power 3-axis accelerometer introduction this document provides application information for the low-voltage 3-axis digital output linear mems accelerometer housed in an lga package. the lis331dlm is a high performance ultra low-power 3-axis linear accelerometer which belongs to the ?nano? family of mems accelerometers, with digital i 2 c/spi serial interface standard output. the device features ultra low-power operational modes that allow advanced power saving and smart sleep to wake functions. the lis331dlm has dynamically user-selectable full scales of 2 g /4 g / 8 g and is capable of measuring acceleration with output data rates from 0.5 hz to 400 hz. the self-test capability allows th e user to check the functioning of the sensor in the final application. the device can be configured to generate interrupt signals in response to inertial wakeup/free-fall events or based on the position of the device itself. the thresholds and timing of interrupt generators are programmable by the end user ?on the fly?. the lis331dlm is available in a small, thin plastic land grid array (lga) package and is guaranteed to operate over an wide temperature range of -40 c to +85 c. www.st.com
contents AN2989 2/28 doc id 15761 rev 1 contents 1 register table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2 startup sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.1 reading acceleration data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.1.1 using the status register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.1.2 using the dataready signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.2 output data rate selection and reading timing . . . . . . . . . . . . . . . . . . . . . . 8 2.3 dataready vs. interrupt signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.4 understanding acceleration data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.4.1 data alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.4.2 example of acceleration data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3 operating modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.1 normal mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.2 power-down mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.3 low-power mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.4 sleep to wake . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.4.1 entering sleep to wake mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.4.2 exiting sleep to wake mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 4 high-pass filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.1 filter configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.1.1 normal mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4.1.2 reference mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 5 interrupt generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 5.1 duration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 5.2 threshold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 5.3 free-fall and wake-up interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 5.4 inertial wakeup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 5.4.1 hp filter bypassed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 5.4.2 using the hp filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
AN2989 contents doc id 15761 rev 1 3/28 5.5 free-fall detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 5.6 6d direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 6 revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
list of tables AN2989 4/28 doc id 15761 rev 1 list of tables figure 1. reading timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 figure 2. interrupt and dataready signal generation block diagram. . . . . . . . . . . . . . . . . . . . . . . . . 10 figure 3. dataready signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 figure 4. sleep to wake mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 figure 5. high-pass filter connections block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 figure 6. hp_filter_reset readings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 7 figure 7. reference mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 figure 8. free-fall, wake-up interrupt generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 figure 9. ff_wu_cfg high and low. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 figure 10. inertial wakeup interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 figure 11. free-fall interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 figure 12. zh, zl, yh, yl, xh, xl behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 figure 13. 6d movement vs. 6d position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 figure 14. 6d recognized positions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
AN2989 list of figures doc id 15761 rev 1 5/28 list of figures figure 1. reading timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 figure 2. interrupt and dataready signal generation block diagram. . . . . . . . . . . . . . . . . . . . . . . . . 10 figure 3. dataready signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 figure 4. sleep to wake mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 figure 5. high pass filter connections block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 figure 6. hp_filter_reset readings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 7 figure 7. reference mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 figure 8. free-fall, wakeup interrupt generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 figure 9. ff_wu_cfg high and low. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 figure 10. inertial wakeup interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 figure 11. free-fall interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 figure 12. zh, zl, yh, yl, xh, xl behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 figure 13. 6d movement vs. 6d position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 figure 14. 6d recognized positions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
register table AN2989 6/28 doc id 15761 rev 1 1 register table table 1. register table register name address bit7 bi t6 bit5 bit4 bit3 bit2 bit1 bit0 who_am_i 0fh 0 0 0 1 0 0 1 0 ctrl_reg1 20h pm2 pm1 pm0 dr1 dr0 zen yen xen ctrl_reg2 21h boot hpm1 hpm0 fds hpen2 hpen1 hpcf1 hpcf0 ctrl_reg3 22h ihl pp_od lir2 i2_cf1 i2_cf0 lir1 i1_cf1 i1_cf0 ctrl_reg4 23h bdu ble fs1 fs0 stsign 0 st sim ctrl_reg5 24h - - - - - - turnon1 turnon0 hp_filter_reset 25h - - - - - - - - reference 26h ref7 ref6 ref5 ref4 ref3 ref2 ref1 ref0 status_reg 27h zyxor zor yor xor zyxda zda yda xda out_x 29h xd7 xd6 xd5 xd4 xd3 xd2 xd1 xd0 out_y 2bh yd7 yd6 yd5 yd4 yd3 yd2 yd1 yd0 out_z 2dh zd7 zd6 zd5 zd4 zd3 zd2 zd1 zd0 int1_cfg 30h aoi 6d zhie zlie yhie ylie xhie xlie int1_src 31h - ia zh zl yh yl xh xl int1_ths 32h 0 ths6 ths5 ths4 ths3 ths2 ths1 ths0 int1_duration 33h 0 d6 d5 d4 d3 d2 d1 d0 int2_cfg 34h aoi 6d zhie zlie yhie ylie xhie xlie int2_src 35h - ia zh zl yh yl xh xl int2_ths 36h 0 ths6 ths5 ths4 ths3 ths2 ths1 ths0 int2_duration 37h 0 d6 d5 d4 d3 d2 d1 d0
AN2989 startup sequence doc id 15761 rev 1 7/28 2 startup sequence once the device is powered up it automatically downloads the calibration coefficients from the embedded flash to the internal registers. when the boot procedure is complete (after approximately 5 milliseconds), the device automatically enters power-down mode. to turn on the device and gather acceleration data, it is necessary to select one of the operating modes through the ctrl_reg1 register, and to enable at least one of the axes. the following general-purpose sequences can be used to configure the device: 1. write ctrl_reg1 2. write ctrl_reg2 3. write ctrl_reg3 4. write ctrl_reg4 5. write reference 6. write int1_ths 7. write int1_dur 8. write int2_ths 9. write int2_dur 10. read hp_filter_reset (if filter is enabled) 11. write int1_cfg 12. write int2_cfg 13. write ctrl_reg5 register values can be changed at any time, with the device in any operating mode. modifications take effect immediately. note that in case of changes in full scale, odr or enabling/disabling of self-test, the output of the device requires 3 to 8 samples to settle (see ta bl e 1 1 ). in cases where the hp filter cut-off frequency is ch anged, the filter can be reset by reading hp_filter_reset register.
startup sequence AN2989 8/28 doc id 15761 rev 1 2.1 reading acceleration data 2.1.1 using the status register the device is provided with a status_reg which should be polled to check when a new set of data is available. the reading procedure should be the following: the check performed at step 3 determines whether the reading rate is adequate compared to the data production rate. in cases where one or more acceleration samples have been overwritten by new data due to an excessively slow reading rate, the zyxor bit of status_reg is set to 1. the overrun bits are automatically cleared when all the data present inside the device have been read and new data have not been produced in the meantime. 2.1.2 using the dataready signal the device may be configured to have one hw signal to determine when a new set of measurement data is available for reading. this signal is represented by the xyzda bit of the status_reg register. the signal can be driven to the int1 or int2 pins and its polarity set to active-low or active-high through the ctrl_reg3 register. the interrupt is reset when the higher part of the data of all the enabled channels has been read. 2.2 output data rate se lection and reading timing the output data rate is user selectable through the drx bits of the ctrl_reg1 (20h) register. at power-on-reset, the drx are reset to 0, thus providing a default output data rate of 50 hz. the analog signal coming from the mechanical sensor is filtered by a low pass filter before being converted by the internal adc. the frequency at -3 db of the low pass filter determines the effective system resolution. the cut-off frequency depends on the dr<1:0> bits in the ctrl_reg1 (20h) register ( ta bl e 2 ). 1 read status_reg 2 if status_reg(3) = 0 then goto 1 3 if status_reg(7) = 1 then some data have been overwritten 4 read outx_l 5 read outx_h 6 read outy_l 7 data processing 7 goto 1
AN2989 startup sequence doc id 15761 rev 1 9/28 note: the precision of the output data rate is related to the internal osc illator; an error of +/- 10% should be taken in account. a typical reading period is defined which is 616 s shorter than the output data rate period, in order to prevent the loss of any data produced. during this time period the reading of the data must be performed and the dataready signal can be used as a trigger to begin the reading sequence. at the end of the complete sequence, the dataready signal goes down and the rising edge that follows signals that new data are available. if this minimum reading frequency is not observed, some data loss is possible and the dataready signal no longer signifies a trigger signal. the status register can be used to infer whether an overrun has occurred. figure 1. reading timing 2.3 dataready vs. interrupt signal the device is equipped with two pins that can be activated to generate either the dataready or the interrupt signal. the functionality of the pins is selected acting on bit i1(2)_cfgx bits of the ctrl_reg3 register, according to ta b l e 4 and with the block diagram given in figure 2 . table 2. output data rate dr1, dr0 output data rate analog filter cut-off frequency. (-3 db) 00 50 hz 37 hz 01 100 hz 74 hz 10 400 hz 292 hz table 3. timing value to avoid losing data time description min t0 data rate 1/odr t1 reading period t0-t2 t2 new data generation (typ) 616 s $ata2eady 4 4 4 .ewdataavailable !-v table 4. data signal on int 1 and int 2 pads i1(2)_cfg1 i1(2)_cfg0 int 1(2) pin 0 0 interrupt 1 (2) source 0 1 interrupt 1 source or interrupt 2 source 1 0 dataready 1 1 boot running
startup sequence AN2989 10/28 doc id 15761 rev 1 figure 2. interrupt and dataready signal generation block diagram in particular, the dataready (dr) signal rises to 1 when a new set of acceleration data has been generated and is available for reading. the signal is reset after all the enabled channels are read through the serial interface. figure 3. dataready signal 2.4 understanding acceleration data the measured acceleration data are sent into the outx, outy, outz registers. acceleration data for the x (y, z) channel is expressed as a 2?s complement number. 2.4.1 data alignment acceleration data are represented as 8-bit numbers, two?s complement and are right justified. 2.4.2 example of acceleration data ta bl e 5 provides a few basic examples of the data that is read in the data registers when the device is subject to a given acceleration. the values listed in the table are given under the hypothesis of perfect device calibration (no offset, no gain error, etc.). !-v &ree &all 7ake 5p )nterrupt #ounter /$2#lock ).4x?$52!4)/. ,atch #42,?2%',)2   'enerator  to 0ad )! ).4 ?32# ).4 &ree &all 7ake 5p )nterrupt #ounter /$2#lock ).4x?$52!4)/. ,atch #42,?2%',)2 'enerator )! ).4 ?32#      $ata2eadysignal $ata2eady 3ignal 'enerator "//4 ) ?#&' ) ?#&' !-v 2$9 $!4!2%!$  .   e l p m a 3  l e c c ! .   e l p m a 3  l e c c ! ! 4 ! $ , % # # ! 89: 89:
AN2989 startup sequence doc id 15761 rev 1 11/28 table 5. output data register content vs. acceleration (fs = 2 g ) acceleration values register address 29h 0 g 00h 350 mg 15h 1 g 40h -350 mg eah -1g c0h
operating modes AN2989 12/28 doc id 15761 rev 1 3 operating modes the lis331dlh can operate in the following four modes, which can be selected through the configuration of ctr_reg1 and ctrl_reg5: ? normal mode ? power-down ? low-power ? sleep to wake with reference to the datasheet of the device, the power-mode (pm) and data rate (dr) bits of ctrl_reg1 are used to select the basic operating modes (power-down, normal mode and low-power), while the turnon bits of ctrl_reg5 are used to enable the advanced mode (sleep to wake) which also involves the interrupt configuration. note: the pmx bits are disabled if the turnonx bits of ctrl_reg5 are not configured as zeros. table 6. power mode and low-power output data rate configurations pm2 pm1 pm0 power mode selection output data rate [hz] odr lp 000 power-down -- 0 0 1 normal mode odr 010 low-power 0.5 011 low-power 1 100 low-power 2 101 low-power 5 110 low-power 10 table 7. ctrl_reg1 - data rate dr! dr0 data rate generation [hz] odr 00 50 01 100 10 400 table 8. ctrl_reg5 - sleep to wake configuration turnon1 turnon0 sleep to wake status 0 0 sleep to wake function disabled 0 1 an interrupt event is occurred an d system is generat ing data at odr 1 0 not allowed 1 1 sleep to wake function enabled
AN2989 operating modes doc id 15761 rev 1 13/28 ta bl e 9 and ta bl e 1 0 show the typical power consumption values for the different operating modes. note: higher data rates correspond to lower device resolution. 3.1 normal mode in normal mode data are generated at the data rate (odr) selected through the dr bits and for the axis enabled through the zen, yen and xen bits of ctrl_reg1. data generated for a disabled axis is 00h. data interrupt generation is active and configured through int1_cfg and int2_cfg registers. 3.2 power-down mode when the device is in power-down mode, almost all internal blocks of the device are switched off to minimize power consumption. digital interfaces (i 2 c and spi) are still active to allow communication with the device. configuration register content is preserved and output data registers are not updated, thus keeping in memory the last data sampled before going to power-down mode. typical turn-on time to go back to normal mode is 1 ms + 1/odr. table 9. power consumption - normal mode ( a) odr 50 hz 100 hz 400 hz power consumption 250 255 290 table 10. power consumption ( a) odr\odr lp 0.5 hz 1 hz 2 hz 5 hz 10 hz 50 hz 10 20 30 60 99 100 hz 10 15 20 40 80 400 hz 10 15 20 40 80 table 11. turn-on time data rate generation (hz) turn-on time - typical (ms) 50 21 100 11 400 3.5
operating modes AN2989 14/28 doc id 15761 rev 1 3.3 low-power mode when the device is in low-power mode data are produced at the odr lp selected by the pm bits of ctrl_reg1. turn-on time follows the same rules as for power-down mode ( ta bl e 1 1 ). 3.4 sleep to wake the sleep to wake function, in conjunction with low-power mode, allows further reduction of system power consumption and development of new smart applications. the lis331dlm may be set to a low-power operating mode, characterized by lower date rate refreshments. in this way the device, ev en if sleeping, continues sensing acceleration and generating interrupt requests. when the sleep to wake function is activated, the lis331dlm is able to automatically wake up as soon as the interrupt event has been detected, increasing the output data rate and bandwidth. with this feature the system may be efficiently switched from low-power mode to full-performance depending on user-selectable positioning and acceleration events, thus ensuring power saving and flexibility. the sleep to wake function is activated through the turnonx bits of ctrl_reg5 ( ta bl e 8 ). when the device is in sleep to wake mode, it automatically samples the acceleration data at odr lp to verify if interrupt conditions are reached. when an interrupt event occurs, the device goes back to generating data at odr ( figure 4 ). if interrupt conditions are not reached, the device remains in low-power mode at odr lp . the device is ready to immediately generate valid samples as soon as it exits from sleep to wake mode. note: at an interrupt event, the contents of ctr_reg5 changes to 0x01 while the content of ctrl_reg1 is left untouched: pmx bits are ignored. to return to normal mode or low- power-mode, the turnonx bits of ctrl_reg5 must be set to zero. figure 4. sleep to wake mode $2 $2 $2 $2 $2 $2 $2 g 7!+%50 4(2%3( /,$ 7ake5p )nterrupt /$2 ,0 $2 $2 $2 /$2 !-v
AN2989 operating modes doc id 15761 rev 1 15/28 3.4.1 entering sleep to wake mode the sequence to set up the sleep to wake function is: 1. configure the desired interrupt event (free-fall, wakeup, 6d position or 6d movements) 2. select the desired low-power mode (odr lp ) and data rate (odr) in ctrl_reg1 3. enable sleep to wake through ctrl_reg5 (turnon1 = turnon0 = 1) once an interrupt event occurs, the turnon bits change to turnon1 = 0 and turnon0 = 1 and the system generates data at odr. the user can re-activate the sleep to wake function by executing step 3 again. 3.4.2 exiting sleep to wake mode to return to normal mode or to low-power mode, the user must disable the sleep to wake function by setting turnon1 = turnon0 = 0.
high-pass filter AN2989 16/28 doc id 15761 rev 1 4 high-pass filter the lis331dlm provides embedd ed high-pass filtering capab ility to easily delete the dc component of the measured acceleration. as shown in figure 5 , it is possible to independently apply the filter on the output data and/or on the interrupts data through the fds, hpen1 and hpen2 bits of the ctrl_reg2 register configuration. this means that it is possible, for example, to obtain filtered data while interrupt generation works on unfiltered data. figure 5. high-pass filter connections block diagram 4.1 filter configuration as shown in ta b l e 1 2 , two operating modes are possible for the high-pass filter: : the bandwidth of the high-pass filter depends on the selected odr and on the settings of hpcfx bits of ctrl_reg2. the high-pass filter cut-off frequencies (f t ) are shown in ta bl e 1 3 . !-v )nterrupt #42,?2%'(0en  #42,?2%'&$3  2egs!rray   )nterrupt #42,?2%'(0en   /utputregs 32#reg 32#reg 3ource 3ource $!4! &),4%2%$$!4! table 12. high-pass filter mode configuration hpm1 hpm0 0 0 normal mode (reset reading hp_reset_filter) 0 1 reference mode 1 0 same as configuration 00h 1 1 not allowed
AN2989 high-pass filter doc id 15761 rev 1 17/28 4.1.1 normal mode in this configuration the high-pass filter can be reset reading the hp_filter_reset register, instantly matching the output data to the input acceleration. figure 6. hp_filter_reset readings 4.1.2 reference mode in reference mode configuration the output data is calculated as the difference between the input acceleration and the content of the reference register. this register is in 2?s complement representation and the value of 1lsb of these 7-bit registers depends on the selected full scale ( ta bl e 1 4 ). table 13. high-pass filter cut-off frequency configuration hpcoeff2,1 f t [hz] data rate = 50 hz f t [hz] data rate = 100 hz f t [hz] data rate = 400 hz 00 1 2 8 01 0.5 1 4 10 0.25 0.5 2 11 0.125 0.25 1 !-v )nput!cceleration &iltered$ata table 14. reference mode lsb value full scale reference mode lsb value (mg) 2~16 4~31 8~63
high-pass filter AN2989 18/28 doc id 15761 rev 1 figure 7. reference mode !-v )nput!cceleration &iltered$ata 2%&%2%.#%enable 2%&%2%.#%
AN2989 interrupt generation doc id 15761 rev 1 19/28 5 interrupt generation the lis331dlm can provide two interrupt si gnals and offers several possibilities to personalize these signals. the registers involved in the interrupt generation behavior are ctrl_reg3, int1_cfg, int2_cfg, int1_ths, int2_ths, int1_duration, int2_duration. the lis331dlm interrupt signal can behave as free-fall, wakeup or 6d orientation detection. whenever an interrupt condition is verified, the interrupt signal is generated and by reading the int1_src and int2_src registers it is possible to detect which condition has occurred. 5.1 duration the content of the duration registers set the minimum duration of the interrupt event to be recognized. duration steps and maximum values depend on the odr chosen. when in normal mode, duration time is measured in n/odr, where n is the content of the duration register and odr is 50, 100, 400 hz. when in low-power mode, duration time is measured in n/odr lp , where n is the content of the duration register and odr lp is 0.5, 1, 2, 5, 10 hz. table 15. interrupt mode configuration aoi 6d interrupt mode 0 0 or combination of interrupt events 0 1 6 direction move ment recognition 1 0 and combination of interrupt events 1 1 6 direction position recognition table 16. duration of lsb value in normal mode odr (hz) duration of lsb value (ms) 50 20 100 10 400 2.5 table 17. duration of lsb value in low-power mode odr (hz) duration of lsb value (s) 0.5 2 11 20.5
interrupt generation AN2989 20/28 doc id 15761 rev 1 5.2 threshold threshold registers define the reference accelerations used by the interrupt generation circuitry. the value of 1lsb of these 7-bit registers depends on the selected full scale ( ta bl e 1 8 ). 5.3 free-fall and wakeup interrupts the lis331dlm interrupt signals can behave as free-fall, wakeup or 6d orientation detection. when an interrupt condition is verified, the interrupt signal is generated and by reading the int1_src and int2_src registers it is possible to determine which condition has occurred. the free-fall signal (ff) and wakeup signal (wu) interrupt generation block is represented in figure 8 . ff or wu interrupt generation is selected through the aoi bit in intx_cfg register. if the aoi bit is ?0?, signals coming from comparators are put in logical ?or?. depending on the values written in the int1_cfg register, every time the value of at least one of the enabled axes exceeds the threshold written in module in intx_ths registers, a wu interrupt is generated. otherwise, if the aoi bit is ?1?, signals coming from the comparators go into a ?nand? port. in this case, an interrupt signal is generated only if all the enabled axes exceed the threshold written in the intx_ths register. the lirx bits of the ctrl_reg3 can be used to determine whether or not the interrupt request must be latched. if the lirx bit is ?0? (default value), the interrupt signal goes high when the interrupt condition is satisfied and immediately returns low if the inte rrupt condition is no longer verified. otherwise, if the lirx bit is ?1?, when an interrup t condition is applied, the interrupt signal remains high even if the condition returns to a non-interrupt status, until a reading of the intx_src register is performed. the zhie, zlie, yhie, ylie, xhie and hlie bits of the intx_cfg register select on which axis the interrupt decision must be performed, and in which direction the threshold must be exceeded to generate the interrupt request. 50.2 10 0.1 table 17. duration of lsb value in low-power mode (continued) odr (hz) duration of lsb value (s) table 18. threshold lsb value full scale threshold lsb value (m g ) 2~16 4~31 8~63
AN2989 interrupt generation doc id 15761 rev 1 21/28 figure 8. free-fall, wakeup interrupt generator the threshold module which is used by the system to detect free-fall or inertial wakeup events is defined by the intx_ths registers. the threshold value is expressed over 7 bits as an unsigned number and is symmetrical around the zero-g level. xh (yh, zh) is true when the unsigned acceleration value of the x (y, z) channel is higher than intx_ths. similarly, xl, (yl, zl) low is true when the unsigned acceleration value of the x (y, z) channel is lower than intx_ths. refer to figure 9 for additional details. figure 9. ff_wu_cfg high and low !-v 4(3reg \b\a \b\a !ccel?8 8(% 8,% 75 &&   ).4x?#&'!/) \b\a \b\a 9(% 9,% \b\a \b\a :(% :,% !ccel?9 !ccel?: !-v &ull3cale &ull3cale glevel 4hresholdmodule 4hresholdmodule 89 : high 89 : high 89 : low 0ositive .egative acceleration acceleration
interrupt generation AN2989 22/28 doc id 15761 rev 1 5.4 inertial wakeup the wakeup interrupt refers to a specific configuration of the intx_ctrl registers that allow the interrupt generation when the acceleration on the configured axis exceeds a defined threshold ( figure 10 ). figure 10. inertial wakeup interrupt 5.4.1 hp filter bypassed this paragraph provides a basic algorithm which shows the practical use of the inertial wakeup feature. in particular, with the code below, the device is configured to recognize when the absolute acceleration along either x or y axis exceeds a preset threshold (250 m g used in the example). the event which triggers the interrupt is latched inside the device and its occurrence is signaled through the use of the int1 pin. !-v g 7!+%50 4(2%3(/,$ 75)nterrupt g 7!+%50 4(2%3(/,$ 1 write 2fh into ctrl_reg1 // turn-on the sensor and enable x, y and z // odr = 100 hz 2 write 00h into ctrl_reg2 // high-pass filter disabled 3 write 00h into ctrl_reg3 // latched interrupt active high on int1 pad 4 write 00h into ctrl_reg4 // fs = 2g 5 write 00h into ctrl_reg5 // sleep to wake disabled 6 write10h into int1_ths // threshold = 250 mg 7 write 00h into int1_duration // duration = 0 8 write 0ah into int1_cfg // enable xh and yh interrupt generation 9 poll int1 pad; if int1=0 then goto 8 // poll rdy/int pin waiting for the // wakeup event 10 read int1_src // return the event that has triggered the // interrupt 11 (wakeup event has occurred; insert your code here) // event handling 12 goto 8
AN2989 interrupt generation doc id 15761 rev 1 23/28 5.4.2 using the hp filter the code which follows provides a basic routine showing the practical use of the inertial wakeup feature performed on high-pass filtered data. in particular, the device is configured to recognize when the high-frequency component of the acceleration applied along either the x, y or z axis exceeds a preset threshold (250 m g is used in the example). the event which triggers the interrupt is latched inside the device and its occurrence is signalled through the int1 pin. at step 8, a dummy read at the hp_filte r_reset register is performed to set the current/reference acceleration/tilt state against which the device performed the threshold comparison. this read may be performed any time it is required to set the orientation/tilt of the device as a reference state without waiting for the filter to settle. 5.5 free-fall detection free-fall detection refers to a specific configuration of the intx_ctrl registers that allows the recognition of device free-fall: the acceleration measurements along all the axes go to zero. in real cases, a ?free-fall zone? is defined around the zero-g level, where all accelerations are small enough to generate the interrupt ( figure 11 ). 1 write 2fh into ctrl_reg1 // turn on the sensor, enable x, y and z // odr = 100 hz 2 write 15h into ctrl_reg2 // high-pass filter enabled on data and interrupt1 3 write 00h into ctrl_reg3 // latched interrupt active high on int1 pad 4 write 00h into ctrl_reg4 // fs = 2 g 5 write 00h into ctrl_reg5 // sleep to wake disabled 6 write10h into int1_ths // threshold = 250 mg 7 write 00h into int1_duration // duration = 0 8 read hp_filter_reset // dummy read to force the hp filter to // actual acceleration value // (i.e. set reference acceleration/tilt value) 9 write 2ah into int1_cfg // configure desired wakeup event 10 poll int1 pad; if int1 = 0 then goto 9 // poll int1 pin waiting for the // wakeup event 11 (wakeup event has occurred; insert your code here) // event handling 12 read int1_src // return the event that has triggered the // interrupt and clear interrupt 13 (insert your code here) // event handling 14 goto 9
interrupt generation AN2989 24/28 doc id 15761 rev 1 figure 11. free-fall interrupt this paragraph provides the fundamentals for using the free-fall detection feature. in particular, the software routine which configures the device to detect and signal free-fall events is as follows: the code sample exploits a threshold set at 350 m g for free-fall recognition and the event is notified by the hardware signa l int1. at step 5, the int1_dura tion register is configured to ignore events that are shorter than 3/dr = 3/100 ~= 30 ms in order to avoid false detections. once the free-fall event has occurred, a read at the int1_src register clears the request and the device is ready to recognize other events. 5.6 6d direction the lis331dlm features an adva nced capability to detect the orientation of the device in space. the 6d direction function can be enabled through the aoi and 6d bits of the int1_cfg register ( ta b l e 3 ). when configured for the 6d function, the zh, zl, yh, yl, xh, 1 write 2fh into ctrl_reg1 // turn-on the sensor, enable x, y and z // odr = 100 hz 2 write 00h into ctrl_reg2 // high-pass filter disabled 3 write 04h into ctrl_reg3 // latched interrupt on int1 4 write 16h into int1_ths // set free-fall threshold = 350 mg 5 write 03h into int1_duration // set minimum event duration 6 write 95h into int1_cfg // configure free-fall recognition 7 poll int1 pad; if int1 = 0 then goto 8 // poll int1 pin waiting for the free-fall event 8 (free-fall event has occurred; insert your code here) // event handling 9 read int1_src register // clear interrupt request 10 goto 7 !-v g &2%%&!,, :/.% 8 9 : &&)nterrupt
AN2989 interrupt generation doc id 15761 rev 1 25/28 xl bits of intx_src send information about the value of the acceleration generating the interrupt when it exceeds the threshold, and whether the acceleration value is positive or negative. more specifically: zh (yh, xh) is 1 when the sensed acceleration is greater than the threshold in the positive direction. zl (yl, xl) is 1 when the sensed acceleration is greater than the threshold in the negative direction. figure 12. zh, zl, yh, yl, xh, xl behavior there are two possible configurations for the 6d direction function: 6d movement recognition : in this configuration the interrupt is generated when the device moves from one direction (known or unknown) to a different, known direction. the interrupt is active only for 1/odr. 6d position recognition : in this configuration the interrupt is generated when the device is stable in a known direction. the in terrupt is active as long as the position is maintained, as shown in figure 13 , (a) and (b). in figure 13 , the 6d movement line shows the behavior of the interrupt when the device is configured for 6d movement recognition on the x and y axes (int1_cfg = 0x4ah), while the 6d position line shows the behavior of the interrupt when the device is configured for 6d position recognition on the x and y axes (int1_cfg = 0xcah). int1_ths is set to 0x21. with reference to figure 14 , the device has been configured for the 6d position function on the x, y and z axes. ta bl e 1 9 shows the content of the int1_src register for each position. figure 13. 6d movement vs. 6d position !-v &ull3cale &ull3cale glevel 4hresholdmodule 4hresholdmodule 8(9( :(  8,9, :,  0ositive .egative acceleration acceleration 8(9( :(  8,9, :,  !-v 8 9 : $0osition $-ovement a b
interrupt generation AN2989 26/28 doc id 15761 rev 1 figure 14. 6d recognized positions table 19. intx_src register in 6d position case ia zh zl yh yl xh xl (a)1000100 (b)1000010 (c)1000001 (d)1001000 (e)1100000 (f)1010000 !-v 8 9 : "ottom 8 9 : 8 9 : 8 9 : 8 9 : 8 9 : 8 9 : 8 9 : 8 9 : 9  8 : 8 9 : 4op 8 9 : 4op b  a  d c f  e 
AN2989 revision history doc id 15761 rev 1 27/28 6 revision history table 20. document revision history date revision changes 24-jun-2009 1 initial release.
AN2989 28/28 doc id 15761 rev 1 please read carefully: information in this document is provided solely in connection with st products. stmicroelectronics nv and its subsidiaries (?st ?) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described he rein at any time, without notice. all st products are sold pursuant to st?s terms and conditions of sale. purchasers are solely responsible for the choice, selection and use of the st products and services described herein, and st as sumes no liability whatsoever relating to the choice, selection or use of the st products and services described herein. no license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. i f any part of this document refers to any third party products or services it shall not be deemed a license grant by st for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoev er of such third party products or services or any intellectual property contained therein. unless otherwise set forth in st?s terms and conditions of sale st disclaims any express or implied warranty with respect to the use and/or sale of st products including without limitation implied warranties of merchantability, fitness for a parti cular purpose (and their equivalents under the laws of any jurisdiction), or infringement of any patent, copyright or other intellectual property right. unless expressly approved in writing by an authorized st representative, st products are not recommended, authorized or warranted for use in milita ry, air craft, space, life saving, or life sustaining applications, nor in products or systems where failure or malfunction may result in personal injury, death, or severe property or environmental damage. st products which are not specified as "automotive grade" may only be used in automotive applications at user?s own risk. resale of st products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by st for the st product or service described herein and shall not create or extend in any manner whatsoev er, any liability of st. st and the st logo are trademarks or registered trademarks of st in various countries. information in this document supersedes and replaces all information previously supplied. the st logo is a registered trademark of stmicroelectronics. all other names are the property of their respective owners. ? 2009 stmicroelectronics - all rights reserved stmicroelectronics group of companies australia - belgium - brazil - canada - china - czech republic - finland - france - germany - hong kong - india - israel - ital y - japan - malaysia - malta - morocco - philippines - singapore - spain - sweden - switzerland - united kingdom - united states of america www.st.com


▲Up To Search▲   

 
Price & Availability of AN2989

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X